package com.byit.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.byit.domain.SysDept;
import com.byit.mapper.SysDeptMapper;
import com.byit.service.ISysDeptService;
import com.byit.utils.PageUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 部门表 服务实现类
 * </p>
 *
 * @author wangx
 * @since 2018-12-11
 */
@Service
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements ISysDeptService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private SysDeptMapper deptMapper;

    @Override
    public void delDeptById(Map<String, Object> params) {
        deptMapper.delDeptById(params);
    }

    @Override
    public Page<JSONObject> selectDeptAll(Page<SysDept> pageInfo, Map<String, Object> params) {
        List<JSONObject> list = deptMapper.selectDeptAll(pageInfo, params);

        Page<JSONObject> page = PageUtil.transform(pageInfo);

        page.setRecords(list);

        return page;
    }
}
